const router = require('koa-router')(),
      adminController = require('../controllers/Admin');

router.prefix('/admin'); //加默认路由

router.get('/create-admin', adminController.createAdmin);

//problem relative
router.get('/add-problem', adminController.getAddProblemPage);
router.post('/add-problem', adminController.addProblem);
router.get('/manage-problem', adminController.getManageProblem);
router.get('/edit-problem/:pid', adminController.getEditProblem);
router.post('/edit-problem', adminController.editProblem);
router.get('/delete-problem/:pid', adminController.deleteProblem);

router.get('/add-problem-type', adminController.getAddProblemTypePage);
router.post('/add-problem-type', adminController.addProblemType);
router.get('/manage-problem-type', adminController.getManageProblemType);
router.get('/edit-problem-type/:id', adminController.getEditProblemType);
router.post('/edit-problem-type', adminController.editProblemType);
router.get('/delete-problem-type/:id', adminController.deleteProblemType);

router.get('/login', adminController.getLoginPage);
router.post('/login-action', adminController.loginAction); //登录
router.get('/login-check', adminController.loginCheck);
router.get('/logout-action', adminController.logoutAction);


module.exports = router;